VINS-Fusion
港科大的空中机器人组开源了很多视觉惯导方案,
有用于单目视觉惯性系统的实时SLAM框架VINS Mono,
并有基于其开发的支持iOS移动端的VINS-Mobile,
有基于VINS Mono的拓展,支持双目/双目+IMU/单目+IMU的VINS-Fusion,
也有相应的鱼眼方案VINS-Fisheye。
打算从VINS-Fusion入手。
环境搭建
Github链接:https://github.com/HKUST-Aerial-Robotics/VINS-Fusion
所需环境:Ubuntu18.04、ROS Melodic、Ceres
Ubuntu18.04
虚拟机方便就方便在于可以直接新创一个系统
简单换源、更新、安装输入法、安装vim
ROS Melodic
安装参考一些教程以及官方网址:http://wiki.ros.org/melodic/Installation/Ubuntu
配置源
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
安装秘钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
更新源、安装ROS Melodic完整版
sudo apt update
sudo apt install ros-melodic-desktop-full
写入环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
安装工具
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
初始化rosdep
sudo rosdep init
rosdep update
(配置完/etc/hosts还不行的话,可以用鱼香ROS的rosdepc)
sudo apt install python3-pip
sudo pip3 install rosdepc
sudo rosdepc init # 现在已经自带了 rosdepc update
跑小海龟验证
rosversion -d
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
Ceres
安装参考官网教程:http://ceres-solver.org/installation.html#linux
#依赖
# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev libgflags-dev
# Use ATLAS for BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse (optional)
sudo apt-get install libsuitesparse-dev
#编译
# 若安装最新:(需要提高CMake版本) git clone https://github.com/ceres-solver/ceres-solver.git
# LocalParameterization在2.2.0版本之后弃用了,改为了Manifold 所以要安装2.2.0之前的版本
wget http://ceres-solver.org/ceres-solver-2.1.0.tar.gz
tar zxf ceres-solver-2.1.0.tar.gz
cd ceres-solver-2.1.0/
mkdir ceres-bin && cd ceres-bin
cmake ..
make
make test
sudo make install
# 测试
bin/simple_bundle_adjuster ../data/problem-16-22106-pre.txt
编译
# 创建工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd .. && catkin_make
# 环境变量
echo "source devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
# 安装
cd ~/catkin_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.git
cd .. && catkin_make
运行
数据集地址:https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
# 下载数据集
cd ~/catkin_ws/src/VINS-Fusion
mkdir datasets && cd datasets
wget http://robotics.ethz.ch/~asl-datasets/ijrr_euroc_mav_dataset/machine_hall/MH_01_easy/MH_01_easy.bag
cd ~/catkin_ws
# 单目+IMU 多个shell
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml
rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml
rosbag play ~/catkin_ws/src/VINS-Fusion/datasets/MH_01_easy.bag
# 双目+IMU 多个shell
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml
rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml
rosbag play ~/catkin_ws/src/VINS-Fusion/datasets/MH_01_easy.bag
# 双目 多个shell
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_config.yaml
rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_config.yaml
rosbag play ~/catkin_ws/src/VINS-Fusion/datasets/MH_01_easy.bag